package cn.gson.boot.model.dao;

import cn.gson.boot.model.pojos.Kehu;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.transaction.annotation.Transactional;

import java.sql.Timestamp;
import java.util.List;

public interface KehuDao extends CrudRepository<Kehu,Integer> {
    //查询客户所有者
    @Query(nativeQuery = true, value = "select count(*) from kehu where emp_id=?1")
    public Integer kehufuzeren(Integer FZ);

    //查询客户
    @Query(nativeQuery = true, value = "select * from kehu k  inner join contacts c2 on k.k_id = c2.k_id left join " +
            "hetong h on k.k_id = h.k_id where k.k_id=?1")
    public Kehu kehuchax(Integer Id);

    //根据客户姓名查询
    @Query(nativeQuery = true, value = "select  count(*) from kehu where k_name=?1")
    public int findKehuByName(String kNAME);
}
